import 'package:gzmall_app/model/picture.dart';
import 'package:json_annotation/json_annotation.dart';

part 'order_item.g.dart';

@JsonSerializable()
class OrderItem extends Object {
  @JsonKey(name: 'id')
  int id;

  @JsonKey(name: 'quantity')
  int quantity;

  @JsonKey(name: 'name')
  String name;

  @JsonKey(name: 'option_value_presentation')
  String optionValuePresentation;

  @JsonKey(name: 'fee')
  String fee;

  @JsonKey(name: 'sku_images')
  List<Picture> skuImages;

  @JsonKey(name: 'spu_id')
  int spuId;

  @JsonKey(name: 'state')
  String state;

  @JsonKey(name: 'state_zh')
  String stateZh;

  @JsonKey(name: 'avatar')
  String avatar;

  bool isSelected = false;

  OrderItem(
    this.id,
    this.quantity,
    this.name,
    this.optionValuePresentation,
    this.fee,
    this.skuImages,
    this.spuId,
    this.state,
    this.stateZh,
    this.avatar,
  );

  factory OrderItem.fromJson(Map<String, dynamic> srcJson) =>
      _$OrderItemFromJson(srcJson);
}
